using System;
using System.Data;

namespace NBear.Mapping.Test
{
    public interface IUser
    {
        int? UserID
        {
            get;
            set;
        }
    }
    public class User : IUser
    {
        private int? id;

        public int? ID
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
            }
        }
        private int? userId;
        public int? UserID
        {
            get { return userId; }
            set { userId = value; }
        }

        public string Name;

        public UserStatus Status;

        public User()
        {
        }

        public User(int? id, string name, UserStatus status)
        {
            this.id = id;
            this.userId = id;
            this.Name = name;
            this.Status = status;
        }

        public static DataTable PrepareDataTable(int rowCount)
        {
            DataTable table = new DataTable("User");
            table.Columns.Add("UserID", typeof(int));
            table.Columns.Add("Name", typeof(string));
            table.Columns.Add("Status", typeof(int));
            int length = rowCount;
            for (int i = 0; i < length; i++)
            {
                DataRow row = table.NewRow();
                row["UserID"] = i;
                row["Name"] = "teddy" + i.ToString();
                row["Status"] = (int)UserStatus.Admin;
                table.Rows.Add(row);
            }
            return table;
        }
    }

    public class User2 : IUser
    {
        private int? id;

        public int? ID
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
            }
        }
        private int? userId;
        public int? UserID
        {
            get { return userId; }
            set { userId = value; }
        }

        private string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }


        private UserStatus status;

        public UserStatus Status
        {
            get { return status; }
            set { status = value; }
        }


        public User2()
        {
        }

        public User2(int? id, string name, UserStatus status)
        {
            this.id = id;
            this.userId = id;
            this.name = name;
            this.status = status;
        }

        public static DataTable PrepareDataTable(int rowCount)
        {
            DataTable table = new DataTable("User");
            table.Columns.Add("UserID", typeof(int));
            table.Columns.Add("Name", typeof(string));
            table.Columns.Add("Status", typeof(int));
            int length = rowCount;
            for (int i = 0; i < length; i++)
            {
                DataRow row = table.NewRow();
                row["UserID"] = i;
                row["Name"] = "teddy" + i.ToString();
                row["Status"] = (int)UserStatus.Admin;
                table.Rows.Add(row);
            }
            return table;
        }
    }

    public enum UserStatus
    {
        Normal,
        Admin
    }

}
